package edu.zut.cs.software.cms.module.all.clazz.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.zut.cs.software.cms.base.domain.BaseTreeEntity;

/**
 * This is Grade Entity.
 * 
 * @author 42276
 *
 */
@Entity
@Table(name = "T_GRADE")
@NamedQueries({ @NamedQuery(name = "Grade.getRoot", query = "select m from Grade m where m.parent is null") })
public class Grade extends BaseTreeEntity<Grade, Long> {
	private static final long serialVersionUID = 4373909818672794337L;

	/**
	 * 年级所属的学院
	 */
	@Column
	String department;
	/**
	 * 年级所属的专业
	 */
	@Column
	String major;
	/**
	 * 年段长
	 */
	@Column
	String grade_teacher;

//@OneToMany(cascade = CascadeType.ALL, mappedBy = "CLAZZ_GRADE_ID", fetch = FetchType.LAZY, orphanRemoval = true)
	@OneToMany(mappedBy = "grade", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	List<Clazz> clazzes;

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getMajor() {
		return major;
	}

	public void setMajor(String major) {
		this.major = major;
	}

	public String getGrade_teacher() {
		return grade_teacher;
	}

	public void setGrade_teacher(String grade_teacher) {
		this.grade_teacher = grade_teacher;
	}

}
